/// @tags:
#include <cstdio>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

typedef long long LL;

constexpr int maxn = 1e7 + 3, mod = 1000000007;

int l, r, scnt;
bool vis[maxn];
int fac[maxn], ifac[maxn];

inline LL qpow(LL base, int exp) {
  LL res = 1;
  for (; exp; exp >>= 1, base = (LL)base * base % mod)
    if (exp & 1) res = (LL)res * base % mod;
  return res;
}

inline void prework(int n) {
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = (LL)fac[i - 1] * i % mod;
  ifac[n] = qpow(fac[n], mod - 2);
  for (int i = n - 1; i >= 0; --i) ifac[i] = (LL)ifac[i + 1] * (i + 1) % mod;
}

inline LL C(int n, int m) { return n < m ? 0 : (LL)fac[n] * ifac[m] % mod * ifac[n - m] % mod; }

inline int main() {
  cin >> l >> r;
  prework(r);
  for (int i = l; i <= r; ++i) {
    if (!vis[i]) {
      scnt++;
      for (int j = i; j <= r; j += i) vis[j] = true;
    }
  }
  int ans = 0, n = r - l + 1;
  for (int i = 1; i <= n; ++i) {
    ans = (ans +
           (LL)i * scnt % mod * C(n - scnt, n - i) % mod * fac[n - i] % mod * fac[i - 1] % mod) %
          mod;
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P4562 [JXOI2018] 游戏.in", "r", stdin);
  freopen("P4562 [JXOI2018] 游戏.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
